using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MyFrame.Single;
using UnityEngine;

public class SOMgr : SingletonMonoGlobal<SOMgr>
{
    // public event Action OnSODataLoaded;

    // private Dictionary<CharacterType, CharacterDataSO> characterDataDic = new Dictionary<CharacterType, CharacterDataSO>();
    // private Dictionary<T, ScriptableObject> dataDic = new();
    // private CharacterDataSO characterData;

    void Awake()
    {
        //加载 所有角色数据
        // var res = await AAMgr.Instance.LoadAssetsWithTagAsync<CharacterDataSO>("CharacterData");
        // var characterDataList = res.ToList();
        // characterDataDic = characterDataList.ToDictionary(item => item.characterType, item => item);
        // characterData = AAMgr.LoadAsset<CharacterDataSO>("CharacterData");

#if UNITY_EDITOR
        // var duplicates = characterDataList
        //         .GroupBy(item => item.characterType)
        //         .Where(group => group.Count() > 1)
        //         .Select(group => group.Key);

        // foreach (var duplicate in duplicates)
        // {
        //     Debug.LogWarning($"角色类型重复: {duplicate}");
        // }
#endif
    }

    /// <summary>
    /// 返回角色数据
    /// </summary>
    /// <param name="characterType"></param>
    /// <returns></returns>
    // public CharacterDataDetails GetCharacterDataDetails(CharacterType characterType) => characterData.GetCharacterDataDetails(characterType);
}
